package com.wm.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wm.system.domain.SellingCar;
import com.wm.system.mapper.SellingCarMapper;
import com.wm.system.service.ISellingCarService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hyq
 * @since 2023-10-09 22:33:01
 */
@Service
public class SellingCarServiceImpl extends ServiceImpl<SellingCarMapper, SellingCar> implements ISellingCarService {

    @Override
    public List<SellingCar> selectSellingCar(SellingCar sellingCar) {
        List<SellingCar> list = this.lambdaQuery().eq(SellingCar::getShopId, sellingCar.getShopId()).list();
        return list;
    }

    @Override
    public void addOrUpdate(SellingCar sellingCar) {
        if(sellingCar.getId()==null){
            sellingCar.setCreateTime(LocalDateTime.now());
        }
        this.saveOrUpdate(sellingCar);
    }
}
